﻿
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace WinnerCMS.Data.Mapping
{
    public partial class RightMap
        : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<WinnerCMS.Model.Right>
    {
        public RightMap()
        {
            // table
            //ToTable("CMS_Right");

            // keys
            HasKey(t => t.Id);

            // Properties
            Property(t => t.Id)
                
                .IsFixedLength()
                .IsUnicode(false)
                .HasMaxLength(36)
                .IsRequired();
            Property(t => t.ModelId)
                .IsUnicode(false)
                .HasMaxLength(50)
                .IsOptional();
            Property(t => t.Name)
                
                .HasMaxLength(50)
                .IsOptional();
            Property(t => t.Code)
                
                .HasMaxLength(50)
                .IsOptional();
            Property(t => t.OldCode)
                
                .HasMaxLength(50)
                .IsOptional();
            Property(t => t.RootId)
                
                .IsRequired();
            Property(t => t.OrderId)
                
                .IsRequired();
            Property(t => t.ParentId)
                .IsUnicode(false)
                .HasMaxLength(50)
                .IsOptional();
            Property(t => t.IsAdmin)
                
                .IsRequired();
            

            // Relationships
            HasMany(t => t.Roles)
                .WithMany(t => t.Rights);
            HasMany(t => t.Users)
                .WithMany(t => t.Rights);


            //InitializeMapping();
        }
    }
}

